<?php
header("Access-Control-Allow-Origin:*");
 header('content-type:text/html;charset=utf-8');
 $server = 'localhost';
 $username = 'root';
 $adname = '2014';
 $password = 'root';
 $conn = mysqli_connect($server,$username,$password,$adname);
 if(!$conn){
     die('shujiu');

 }
 
 $username = $_REQUEST['username'];
 $password = $_REQUEST['password'];

$sql = "select * from shop where username='$username' and password='$password'";
 
$res = mysqli_query($conn,$sql);
$data = mysqli_fetch_assoc($res);
if ($data&&$data['password']===$password) {
    
    
    echo json_encode(array(
        "code" => 1,
        "msg" => "登录成功"
    ));
} else {
    echo json_encode(array(
        "code" => 0,
        "msg" => "网络错误，请重试"
    ));
}
 
 
